package app.circlerequest;

import java.net.HttpURLConnection;
import java.net.URL;

/**
 * 用于用户服务器定期向转发服务器请求，服务器收到请求之后会主动发送上次请求到现在这一段时间的数据
 * @author haoqi
 *2017-10-20 16:46:32
 */
public class CircleRequest {

	
	
	public void httpRequest(String url,String data){
		HttpURLConnection urlConnection=null;
		try {
			URL requestUrl = new URL(url);
			
			urlConnection = (HttpURLConnection) requestUrl.openConnection();
			
			urlConnection.setDoOutput(true);
			
			urlConnection.setDoInput(true);
			
			urlConnection.setUseCaches(false);
			
			urlConnection.setRequestMethod("POST");
			
			urlConnection.connect();
			
			urlConnection.getInputStream();

		} catch (Exception e) {
			
			System.out.println("httpRequest失败！");
			//e.printStackTrace();
		}finally {
			urlConnection.disconnect();
		}
		
		
	}
	 
	
}
